﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.Common;
using System.Data.EntityClient;

namespace CommonServiceLibrary.EntityFramework
{
    public static class EFUtil
    {
        public static void AddEntityParameter(DbCommand cmd, string parameterName, DbType valueType, object value)
        {
            EntityParameter entityParameter;
            entityParameter = new EntityParameter(parameterName, valueType);
            entityParameter.Value = value;
            cmd.Parameters.Add(entityParameter);
        }

        public static void AddEntityParameter(DbCommand cmd, string parameterName, DbType valueType, ParameterDirection direction, object value)
        {
            EntityParameter entityParameter;
            entityParameter = new EntityParameter(parameterName, valueType);
            entityParameter.Value = value;
            entityParameter.Direction = direction;
            cmd.Parameters.Add(entityParameter);
        }
    }
}
